package com.zzx.entity.emun;

/**
 * @Author: zzx
 * @Date: 2025/6/20 23:23
 */
public enum BusinessTypeEnum {
    PRODUCT("product", "产品"),
    PRODUCT_ORDER("productOrder", "产品单");

    private final String code;
    private final String description;

    BusinessTypeEnum(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    /**
     * 根据编码获取枚举实例
     */
    public static BusinessTypeEnum fromCode(String code) {
        for (BusinessTypeEnum type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        throw new IllegalArgumentException("未知的业务类型编码: " + code);
    }
}
